/*******************************************************************************
  * @file    io.h
  * @author  chumanhcuong@hlab.com.vn
  * @version V1.0
  * @date    26-05-2012
  * @brief   This library support for GT2
  ******************************************************************************/
	
#include "stm32f10x.h"
#define IOm			17
#define IO_NULL 0xff
typedef enum{BUT1=0,BUT2,BUT3,SEL_LED1,SEL_LED2,SEL_LED3,SEL_LED4,
             SEG7_A,SEG7_B,SEG7_C,SEG7_D,SEG7_E,SEG7_F,SEG7_G,IO_LIMIT,LED1,LED2,LED3}InOutTypeDef;
/**
 * @brief Input/Output Define
 */
/* define of input */
#define BUT1_PIN                    GPIO_Pin_6	
#define BUT1_PORT                   GPIOC
#define BUT1_CLK                    RCC_APB2Periph_GPIOC 

#define BUT2_PIN                    GPIO_Pin_6	
#define BUT2_PORT                   GPIOC
#define BUT2_CLK                    RCC_APB2Periph_GPIOC 

#define BUT3_PIN                    GPIO_Pin_6	
#define BUT3_PORT                   GPIOC
#define BUT3_CLK                    RCC_APB2Periph_GPIOC 

/* define of output */

#define SEL1_PIN                    GPIO_Pin_6	
#define SEL1_PORT                   GPIOC
#define SEL1_CLK                    RCC_APB2Periph_GPIOC 

#define SEL2_PIN                    GPIO_Pin_6	
#define SEL2_PORT                   GPIOC
#define SEL2_CLK                    RCC_APB2Periph_GPIOC 

#define SEL3_PIN                    GPIO_Pin_6	
#define SEL3_PORT                   GPIOC
#define SEL3_CLK                    RCC_APB2Periph_GPIOC 

#define SEL4_PIN                    GPIO_Pin_6	
#define SEL4_PORT                   GPIOC
#define SEL4_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_A_PIN                    GPIO_Pin_6	
#define SEG7_A_PORT                   GPIOC
#define SEG7_A_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_B_PIN                    GPIO_Pin_6	
#define SEG7_B_PORT                   GPIOC
#define SEG7_B_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_C_PIN                    GPIO_Pin_6	
#define SEG7_C_PORT                   GPIOC
#define SEG7_C_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_D_PIN                    GPIO_Pin_6	
#define SEG7_D_PORT                   GPIOC
#define SEG7_D_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_E_PIN                    GPIO_Pin_6	
#define SEG7_E_PORT                   GPIOC
#define SEG7_E_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_F_PIN                    GPIO_Pin_6	
#define SEG7_F_PORT                   GPIOC
#define SEG7_F_CLK                    RCC_APB2Periph_GPIOC 

#define SEG7_G_PIN                    GPIO_Pin_6	
#define SEG7_G_PORT                   GPIOC
#define SEG7_G_CLK                    RCC_APB2Periph_GPIOC 


#define TIMER_LED1_PIN                    GPIO_Pin_6	
#define TIMER_LED1_PORT                   GPIOC
#define TIMER_LED1_CLK                    RCC_APB2Periph_GPIOC 

#define TIMER_LED2_PIN                    GPIO_Pin_6	
#define TIMER_LED2_PORT                   GPIOC
#define TIMER_LED2_CLK                    RCC_APB2Periph_GPIOC 

#define TIMER_LED3_PIN                    GPIO_Pin_6	
#define TIMER_LED3_PORT                   GPIOC
#define TIMER_LED3_CLK                    RCC_APB2Periph_GPIOC 
/******************************************************************************
** Function name: GSM_ServiceInit()
** Description: This function shall be init  io pin
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_init(InOutTypeDef PIN_SEL);   //IO init
/******************************************************************************
** Function name: IO_read()
** Description: This should be set bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: value of pin 0 or 1
** Remarks: global variables used, side effects
******************************************************************************/
uint8_t IO_read(InOutTypeDef PIN_SEL);    // IO read
/******************************************************************************
** Function name: IO_set()
** Description: This should be set bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_set(InOutTypeDef PIN_SEL);    //IO set
/******************************************************************************
** Function name: IO_clr()
** Description: This should be clear bit on PIN
** Parameter X : PIN_SEL - pin selected
** Return value: None
** Remarks: global variables used, side effects
******************************************************************************/
void IO_clr(InOutTypeDef PIN_SEL);    //IO clear bit
